<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/pages/template/modelo.xhtml">
	<ui:define name="titulo">Mural de Fulano</ui:define>
	<ui:define name="cabecalho">
		<div class="win-commandlayout win-ui-dark"
			style="background-color: #424251; height: 50px; float: left; width: 100%;">
			<div class="win-command">
				<h:graphicImage value="/resources/img/friendzone.png" />
			</div>
			<h:form>
				<h:commandLink actionListener="#{auth.logout}">
					<button class="win-command">
						<span class="win-commandicon win-commandring  icon-switch-2"></span>
					</button>
				</h:commandLink>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="corpo">
		<h:form>
			<p:messages showDetail="true" showSummary="false" />
			<p:growl id="messages" showDetail="true" />
			<h:panelGrid columns="1">
				<h:column>
					<h:outputLabel value="Texto" />
					<h:inputTextarea value="#{postagemHome.postagem.texto}" size="250" />
				</h:column>
				<h:column>
					<p:fileUpload fileUploadListener="#{postagemHome.handleFileUpload}"
						update="messages" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
						invalidSizeMessage="Arquivo com tamanho inválido!"
						invalidFileMessage="Arquivo Inválido!" showButtons="true"
						label="Selecionar" multiple="false" cancelLabel="Cancelar"
						uploadLabel="Carregar" />
				</h:column>
				<h:column>
					<h:commandButton value="Postar" action="#{postagemHome.postar}" />
				</h:column>
			</h:panelGrid>
			<h:dataTable value="#{postagemHome.postagens}" var="postagem">
				<h:column>
					<h:panelGrid columns="1">
						<h:column>
							<h:outputLabel value="#{postagem.texto}" />
						</h:column>
						<h:column>
							<h:graphicImage
								value="/recursobinario/#{postagem.recursoBinario.id}"
								width="300" height="300" />
						</h:column>
					</h:panelGrid>
				</h:column>
			</h:dataTable>
		</h:form>
	</ui:define>
</ui:composition>
</html>